﻿using Knlght.Model.news;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Knlght.Mappings
{
    public class SysNewsInfoMapping : EntityTypeConfiguration<NewsInfo>
    {
        public SysNewsInfoMapping()
        {
            // 设置表名
            this.ToTable("Sys"+nameof(NewsInfo));
            //设置主键
            this.HasKey(a => a.Id);
            //自增
            this.Property(t => t.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            //不更新
            this.Property(t => t.AddTime).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Computed);
            // 设置属性的类型和长度
            this.Property(a => a.Title).HasColumnType("NVarchar").HasMaxLength(900);
            this.Property(a => a.SmallTitle).HasColumnType("NVarchar").HasMaxLength(600);
           
        }
    }
}
